﻿using System;
using System.Net.Http;
using System.IO;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using System.Diagnostics;
using System.Collections.Generic;

namespace Rbac.Test
{
    /// <summary>
    /// 单元测试--xunit
    /// </summary>
    internal class Program
    {
        static void Main(string[] args)
        {
            Class1 o1 = new Class1();
            Class1 o2 = new Class1();
            Console.WriteLine(o1);
            Console.ReadLine();



            string[] arr1 = { "1", "2", "3" };

            int[] arr3 = arr1.Select(m => Convert.ToInt32(m)).ToArray();

            int[] arr2 = { 1, 2, 3 };

            var a = new a();
            a.name = "张三";
            var b = a;
            b.name = "李四";
            Console.WriteLine(a.name);
            Console.ReadLine();






            Stopwatch stopwatch = Stopwatch.StartNew();
            stopwatch.Start();
            int i = 0;
            var db = new ApplicationDbContext();
            var list = db.sys_log_op.Take(1).ToList();
            Console.WriteLine(list.Count);
            stopwatch.Stop();
            Console.WriteLine(TimeSpan.FromTicks(stopwatch.ElapsedTicks).TotalSeconds);
            Console.ReadLine();
        }
    }

    class Class1
    {
        private static int c = 0;
        static Class1()
        {
            c++;
        }

        public Class1()
        {
            c++;
        }
    }


    public class a
    {
        public string name { get; set; }
    }

    public class ApplicationDbContext : DbContext
    {
        public DbSet<sys_log_op> sys_log_op { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(@"Data Source=.;Initial Catalog=HotelNet;Integrated Security=True");
        }
    }

    public class sys_log
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int Id { get; set; }
        /// <summary>        
        ///名称
        /// </summary>
        public string Name { get; set; }
    }

    public class sys_log_op
    {
        /// <summary>
        /// 主键
        /// </summary>
        public int Id { get; set; }
        /// <summary>        
        ///名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>        
        ///是否执行成功
        /// </summary>
        public int Success { get; set; }
        /// <summary>        
        ///具体消息
        /// </summary>
        public string Message { get; set; }
        /// <summary>        
        ///IP
        /// </summary>
        public string Ip { get; set; }
        /// <summary>        
        ///地址
        /// </summary>
        public string Location { get; set; }
        /// <summary>        
        ///浏览器
        /// </summary>
        public string Browser { get; set; }
        /// <summary>        
        ///操作系统
        /// </summary>
        public string Os { get; set; }
        /// <summary>        
        ///请求地址
        /// </summary>
        public string Url { get; set; }
        /// <summary>        
        ///类名称
        /// </summary>
        public string ClassName { get; set; }
        /// <summary>        
        ///方法名称
        /// </summary>
        public string MethodName { get; set; }
        /// <summary>        
        ///请求方式
        /// </summary>
        public string ReqMethod { get; set; }
        /// <summary>        
        ///请求参数
        /// </summary>
        public string Param { get; set; }
        
    }
}
